import { SlateElement } from '@wangeditor/editor';
import { Timeline } from './custom-types';

function timelineToHtml(elem: SlateElement, childrenHtml: string): string {
  const { date = '' } = elem as Timeline;
  const html = `<div data-w-e-type="time-line" data-w-e-is-void data-title="${date}">
    <div class="info-container">
      <div class="title-container">${date}</div>
      <div class="line-container"></div>
    </div>
  </div>`;
  return html;
}

// 配置
const conf = {
  type: 'time-line', // 节点 type ，重要！！！
  elemToHtml: timelineToHtml,
};

export default conf;
